package com.allen.study.infrastructure.persistence.assembler;

import com.allen.study.application.api.response.DepartmentQueryResponse;
import com.allen.study.domain.entity.Department;
import com.allen.study.infrastructure.persistence.assembler.mapper.IDepartmentPOStructMapper;
import com.allen.study.infrastructure.persistence.po.DepartmentPO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 部门信息表类型转换
 *
 * @author AllenSun
 * @since 2025-04-23 20:46
 */
@Component
public class DepartmentPOAssembler {

    /**
     * 部门信息表持久化对象装配
     *
     * @param department 部门信息表实体
     * @return 部门信息表持久化对象
     */
    public DepartmentPO assembler(Department department) {
        return IDepartmentPOStructMapper.INSTANCE.fromEntity(department);
    }

    /**
     * 部门信息表持久化对象装配
     *
     * @param departmentList 部门信息表实体
     * @return 部门信息表持久化对象
     */
    public List<DepartmentPO> assembler(List<Department> departmentList) {
        return IDepartmentPOStructMapper.INSTANCE.fromEntity(departmentList);
    }

    /**
     * 部门信息表持久化对象 转 部门信息表实体
     *
     * @param departmentPO 部门信息表持久化对象
     * @return 部门信息表实体
     */
    public Department toEntity(DepartmentPO departmentPO) {
        return IDepartmentPOStructMapper.INSTANCE.toEntity(departmentPO);
    }

    /**
     * 部门信息表持久化对象列表  转 部门信息表实体列表
     *
     * @param departmentPOList 部门信息表持久化对象
     * @return 部门信息表实体
     */
    public List<Department> toEntity(List<DepartmentPO> departmentPOList) {
        return IDepartmentPOStructMapper.INSTANCE.toEntity(departmentPOList);
    }

    /**
     * 部门信息表持久化对象 转 部门信息表查询响应数据传输对象
     *
     * @param departmentPO 部门信息表持久化对象
     * @return 部门信息表查询响应数据传输对象
     */
    public DepartmentQueryResponse toQueryResponse(DepartmentPO departmentPO) {
        return IDepartmentPOStructMapper.INSTANCE.toQueryResponse(departmentPO);
    }

    /**
     * 部门信息表持久化对象列表 转 部门信息表查询响应数据传输对象列表
     *
     * @param departmentPOList 部门信息表持久化对象列表
     * @return 部门信息表查询响应数据传输对象列表
     */
    public List<DepartmentQueryResponse> toQueryResponse(List<DepartmentPO> departmentPOList) {
        return IDepartmentPOStructMapper.INSTANCE.toQueryResponse(departmentPOList);
    }
}
